package com.course.finalproject.model;

import android.os.Parcelable;

import com.course.finalproject.R;

/**
 * Class that represents a weather.
 * @author	Mariano Bessone <mariano.bessone @ tallertechnologies.com>
 * @since	2012-09-14
 */
public abstract class Weather implements Parcelable {

	protected String condition;
	protected String icon;
	
	/**
	 * Default constructor.
	 */
	public Weather() {
		this.condition = "";
		this.icon="";
	}
	
	/**
	 * Constructor with parameters.
	 * 
	 * @param condition The condition name.
	 * @param icon The icon title.
	 */
	public Weather(String condition, String icon) {
		this.condition = condition;
		this.icon = icon;
	}

	/**
	 * It should return if the weather is the current or not.
	 * 
	 * @return True if the weather is the current.
	 */
	public abstract boolean isCurrent();
	
	/**
	 * It should return the weekday of this weather.
	 * 
	 * @return The weekday of this weather.
	 */
	public abstract String getWeekDay();

	/**
	 * It should return the Celsius temperature in a human readable way.
	 * 
	 * @return The Celsius temperature in a human readable way.
	 */
	public abstract String getCelTempReadable();
	
	/**
	 * It should return the Fahrenheit temperature in a human readable way.
	 * 
	 * @return The Fahrenheit temperature in a human readable way.
	 */
	public abstract String getFahTempReadable();
	
	/**
	 * It should return the humidity percentage in a readable way.
	 * 
	 * @return The humidity percentage in a readable way.
	 */
	public abstract String getHumidityReadable();
	
	/**
	 * It should return the wind information in a readable way.
	 * 
	 * @return The wind information in a readable way.
	 */
	public abstract String getWindReadable();
	
	/**
	 * Returns the condition name for this weather forecast.
	 * 
	 * @return The condition name for this weather forecast.
	 */
	public String getCondition() {
		return condition;
	}
	
	/**
	 * Returns the icon title for this weather forecast.
	 * 
	 * @return The icon title for this weather forecast.
	 */
	public String getIcon() {
		return icon;
	}

	/**
	 * Gets the icon resource ID for this weather forecast.
	 * 
	 * @return The icon resource ID for this weather forecast.
	 */
	public int getIconResource() {
		int result = 0;
		if (icon.equals("chanceflurries")) {
			result = R.drawable.chanceflurries;
		} else if (icon.equals("chancerain")) {
			result = R.drawable.chancerain;
		} else if (icon.equals("chancesleet")) {
			result = R.drawable.chancesleet;
		} else if (icon.equals("chancesnow")) {
			result = R.drawable.chancesnow;
		} else if (icon.equals("chancetstorms")) {
			result = R.drawable.chancetstorms;
		} else if (icon.equals("clear")) {
			result = R.drawable.clear;
		} else if (icon.equals("cloudy")) {
			result = R.drawable.cloudy;
		} else if (icon.equals("flurries")) {
			result = R.drawable.flurries;
		} else if (icon.equals("fog")) {
			result = R.drawable.fog;
		} else if (icon.equals("hazy")) {
			result = R.drawable.hazy;
		} else if (icon.equals("mostlycloudy")) {
			result = R.drawable.mostlycloudy;
		} else if (icon.equals("mostlysunny")) {
			result = R.drawable.mostlysunny;
		} else if (icon.equals("partlycloudy")) {
			result = R.drawable.partlycloudy;
		} else if (icon.equals("partlysunny")) {
			result = R.drawable.partlysunny;
		} else if (icon.equals("rain")) {
			result = R.drawable.rain;
		} else if (icon.equals("sleet")) {
			result = R.drawable.sleet;
		} else if (icon.equals("snow")) {
			result = R.drawable.snow;
		} else if (icon.equals("sunny")) {
			result = R.drawable.sunny;
		} else if (icon.equals("tstorms")) {
			result = R.drawable.tstorms;
		}
		
		return result;
	}
	
}
